<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <input type="hidden" name="type" id="type" value="71">
            <a id="subBtn" name="subOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-save"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-save l-btn-icon-left">保存</span></span></a>
            <a class="easyui-linkbutton l-btn l-btn-plain" id="commitBtn" iconcls="icon-redo" plain="true"
                onclick="commit();" style="display:none"><span class="l-btn-left"><span
                        class="l-btn-text icon-redo l-btn-icon-left">提交</span></span></a>
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        申请人：
                    </td>
                    <td>
                        <input type="text" name="applyUserName" id="applyUserName" data-options="required:true"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear0" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('applyUserName,applyUserId');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        审批领导：
                    </td>
                    <td>
                        <input type="text" name="approvalNames" id="approvalNames"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="approvalIds" id="approvalIds">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear2" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('approvalNames,approvalIds');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        总经理：
                    </td>
                    <td>
                        <input type="text" name="managername" id="managername"
                            class="easyui-validatebox texfind validatebox-text" readonly="">
                        <input type="hidden" name="managerid" id="managerid">
                        <a class="easyui-linkbutton l-btn l-btn-plain" id="clear3" iconcls="icon-undo" plain="true"
                            onclick="clearCheck('managername,managerid');"><span class="l-btn-left"><span
                                    class="l-btn-text icon-undo l-btn-icon-left">清除</span></span></a>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        公司名称：
                    </td>
                    <td>
                        <input type="text" name="companyName" id="companyName" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        申请单位印章附件：
                    </td>
                    <td>
                        <input type="hidden" name="objectId" id="objectId" value="1761792708024">
                        <div id="easyContainer"><input type="file" multiple="" class="fileInput"
                                style="display:none;"><a class="formBtn" id="btu_" style="color:#8C8686;"
                                href="javascript:void(0);">上传</a>
                            <div class="flist" style="margin-top: 0px;"></div>
                        </div>
                    </td>
                </tr>


                <tr>
                    <td class="tdc1" style="width:230px;">
                        编号：
                    </td>
                    <td>
                        <input type="text" name="code" id="code" data-options="required:true"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        备案时间：
                    </td>
                    <td>
                        <input type="text" name="recordDate" id="recordDate" readonly="readonly"
                            class="easyui-validatebox Wdate validatebox-text" style="width: 200px"
                            onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        品牌授权范围：
                    </td>
                    <td>
                        <textarea name="brandScope" id="brandScope" style="width:732px;height:100px"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        机构名称全：
                    </td>
                    <td>
                        <input type="text" name="companyqName" id="code" class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        机构名称简：
                    </td>
                    <td>
                        <input type="text" name="companyjName" id="code" class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1" style="width:230px;">
                        基地序号：
                    </td>
                    <td>
                        <input type="text" name="companyjName" id="code" class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        Logo样例：
                    </td>
                    <td>
                        <input type="hidden" name="objectId1" id="objectId1" value="1761792708025">
                        <div id="easyContainer1"><input type="file" multiple="" class="fileInput"
                                style="display:none;"><a class="formBtn" id="btu_" style="color:#8C8686;"
                                href="javascript:void(0);">上传</a>
                            <div class="flist" style="margin-top: 0px;"></div>
                        </div>
                    </td>
                </tr>


                <tr>
                    <td class="tdc1">
                        启迪之星品牌授权范围：
                    </td>
                    <td>
                        <input type="text" name="brandScope" id="brandScope"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>


                <tr>
                    <td class="tdc1">
                        授权机构印章附件：
                    </td>
                    <td>
                        <input type="hidden" name="objectId2" id="objectId2" value="1761792708026">
                        <div id="easyContainer2"><input type="file" multiple="" class="fileInput"
                                style="display:none;"><a class="formBtn" id="btu_" style="color:#8C8686;"
                                href="javascript:void(0);">上传</a>
                            <div class="flist" style="margin-top: 0px;"></div>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>


    <script>
        initSelect(1);//初始化选人框；1：默认根据部门

        initSelectDept();//初始化选择部门

        $("#applyUserName").click(function () {
            showSelect('applyUserName,applyUserId', 'text,id', '');
        });

        $("#approvalNames").click(function () {
            showSelect('approvalNames,approvalIds', 'text,id', 'checkAny');
        });

        $("#managername").click(function () {
            showSelect('managername,managerid', 'text,id', '');
        });


        function checkFormMe(form) {

            return $('#my-form').form('validate');
        }

        var type = $.getUrlParam("type");

        $("#type").val(type);

        var p_id = $.getUrlParam("id");

        var objectId = new Date().getTime();
        var objectId1 = new Date().getTime() + 1;
        var objectId2 = new Date().getTime() + 2;
        $("#objectId").val(objectId);
        $("#objectId1").val(objectId1);
        $("#objectId2").val(objectId2);

        var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/brandLeague' });
        var baseModel;

        if (p_id == null) {
            baseModel = new BaseModel();
        } else {
            baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
        }
        var baseView = new BaseView({ el: $("#my-form"), model: baseModel });


        $(function () {
            //附件
            $('#easyContainer').easyUpload({
                fileTypes: 'all',//all,image,file
                selectText: "上传",//上传按钮文案
                multi: true,//是否允许多文件上传  
                maxNum: 20,//文件上传最大个数
                maxNote: '最多可以上传20个文件，已超出最大上传个数，无法上传！',
                showType: "flist",//展示方。flist,imglist
                fileNote: '文件格式错误，只能上传以下格式',//文件上传说明
                url: contextPath + 'affix',//上传文件地址
                ajaxType: 'POST',//POST,GET
                fileName: 'file',//文件配置参数
                timeout: 300000,//请求超时时间
                formParam: { "objectId": objectId, "objectType": 711 },
            });
            //附件
            $('#easyContainer1').easyUpload({
                fileTypes: 'all',//all,image,file
                selectText: "上传",//上传按钮文案
                multi: true,//是否允许多文件上传  
                maxNum: 20,//文件上传最大个数
                maxNote: '最多可以上传20个文件，已超出最大上传个数，无法上传！',
                showType: "flist",//展示方。flist,imglist
                fileNote: '文件格式错误，只能上传以下格式',//文件上传说明
                url: contextPath + 'affix',//上传文件地址
                ajaxType: 'POST',//POST,GET
                fileName: 'file',//文件配置参数
                timeout: 300000,//请求超时时间
                formParam: { "objectId": objectId1, "objectType": 712 },
            });
            //附件
            $('#easyContainer2').easyUpload({
                fileTypes: 'all',//all,image,file
                selectText: "上传",//上传按钮文案
                multi: true,//是否允许多文件上传  
                maxNum: 20,//文件上传最大个数
                maxNote: '最多可以上传20个文件，已超出最大上传个数，无法上传！',
                showType: "flist",//展示方。flist,imglist
                fileNote: '文件格式错误，只能上传以下格式',//文件上传说明
                url: contextPath + 'affix',//上传文件地址
                ajaxType: 'POST',//POST,GET
                fileName: 'file',//文件配置参数
                timeout: 300000,//请求超时时间
                formParam: { "objectId": objectId2, "objectType": 713 },
            });
        });


        function success(model, response, options) {
            var data = model.get("handleMsg");
            $.messager.alert('提示', model.get("handleMsg").message, 'info', function (rt) {
                if (data.status == 1) {
                    //图层解锁
                    //$("#myForm").unblock();
                    var subtitle = encodeURI(encodeURI($.getUrlParam("subtitle")));
                    window.parent.frames["" + $.getUrlParam("_pfrid")].location.reload();
                    window.location.href = contextPath + "system/qdzxapproval/approval/brandleague_edit.html?type=71&processid=" + model.get("id") + "&_pfrid=" + $.getUrlParam("_pfrid") + "&_frid=" + $.getUrlParam("_frid") + "&subtitle=" + subtitle;
                } else {
                    $("#errorMsg").html(data.message);
                    //图层解锁
                    //$("#myForm").unblock();
                }
            });
        }

    </script>
    <div class="panel window" style="display: none; width: 450px; left: 425.5px; top: 25px;">
        <div class="panel-header panel-header-noborder window-header" style="width: 450px;">
            <div class="panel-title panel-with-icon">根据部门选择</div>
            <div class="panel-icon icon-manager"></div>
            <div class="panel-tool"><a class="panel-tool-collapse" href="javascript:void(0)"></a><a
                    class="panel-tool-close" href="javascript:void(0)"></a></div>
        </div>
        <div id="selectMan" class="easyui-window panel-body panel-body-noborder window-body" title=""
            data-options="closed:true,modal:true,iconCls:'icon-manager',minimizable:false,maximizable:false"
            style="z-index: 301; width: 450px; height: 325px;">
            <div id="selectManHead" class="datagrid-toolbar"><a class="easyui-linkbutton l-btn l-btn-plain"
                    iconcls="icon-ok" plain="true" onclick="checkSelectMan();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-ok l-btn-icon-left">选择</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-reload" plain="true"
                    onclick="reload_data();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-reload l-btn-icon-left">刷新</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close" plain="true"
                    onclick="closeSelectMan();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a></div>
            <div id="menu_tree" class="easyui-tree tree tree-lines" style="margin-top:35px;z-index: 300;"
                data-options="animate:true,lines:true,checkbox:true"></div>
        </div>
    </div>
    <div class="window-shadow" style="display: none; left: 425.5px; top: 25px;"></div>
    <div class="window-mask" style="width: 1301px; height: 572px; display: none;"></div>
    <div class="panel window" style="display: none; width: 350px; left: 475.5px; top: 10px;">
        <div class="panel-header panel-header-noborder window-header" style="width: 350px;">
            <div class="panel-title panel-with-icon">部门选择</div>
            <div class="panel-icon icon-manager"></div>
            <div class="panel-tool"><a class="panel-tool-collapse" href="javascript:void(0)"></a><a
                    class="panel-tool-close" href="javascript:void(0)"></a></div>
        </div>
        <div id="selectDept" class="easyui-window panel-body panel-body-noborder window-body" title=""
            data-options="closed:true,modal:true,iconCls:'icon-manager',minimizable:false,maximizable:false"
            style="width: 350px; height: 355px;">
            <div class="datagrid-toolbar"><a class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-ok" plain="true"
                    onclick="checkSelectDept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-ok l-btn-icon-left">选择</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-reload" plain="true"
                    onclick="reload_data_dept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-reload l-btn-icon-left">刷新</span></span></a><a
                    class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close" plain="true"
                    onclick="closeSelectDept();" id=""><span class="l-btn-left"><span
                            class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a></div>
            <div id="menu_tree_dept" class="easyui-tree tree tree-lines"
                data-options="animate:true,lines:true,checkbox:true"></div>
        </div>
    </div>
    <div class="window-shadow" style="display: none; left: 475.5px; top: 10px;"></div>
    <div class="window-mask" style="width: 1301px; height: 572px; display: none;"></div>
</body>